home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-18 / bklbat.zip / BKLBAT.DOC < prev    next >
Text File  |  1992-02-04  |  14KB  |  330 lines

  1.  
  2.  
  3.  
  4.  
  5.                              BKL.BAT
  6.           A Batch File Using LHA as a Backup Program
  7.  
  8.                          by Dan Goodell
  9.                         February 4, 1991
  10.  
  11.  
  12.  
  13.  
  14.                            THE PREMISE
  15.  
  16.   This program came about from a desire for a cheap, quick, easy
  17. to use, easy to customize backup program that doesn't clutter the
  18. hard disk with massive, additional program files of its own, and
  19. takes up minimal floppy disk space for its backups while using a
  20. standard file compression method.
  21.  
  22.  
  23.  
  24.                             THE IDEA
  25.  
  26.   This backup plan uses a minimum of floppy disk space for two
  27. reasons.  First, the backup files are compressed using the free
  28. program LHA.EXE.  If you don't already have that program, you'll
  29. need to get it.
  30.  
  31.   Second, backups are essentially "incremental" in nature -- not
  32. performed on the entire hard disk, but only on those files that
  33. have changed from a given program's original files since the time
  34. that you installed it.  For example, if you've installed a
  35. wordprocessor, there's really no need to backup all the program
  36. files the word-processor uses to run.  You only need to backup
  37. the program files that are customized for your use (such as a
  38. configuration file of custom settings, or a supplemental spelling
  39. dictionary), and of course the document files you create with the
  40. wordprocessor.  (Your custom program files are easy to spot --
  41. just scan the program files in the directory for any files dated
  42. on or after the date you installed that program.)  If you ever
  43. need to reinstall your wordprocessor from backups, first install
  44. it using a copy of the original program, then use your backup
  45. files to add or overlay the custom files.
  46.  
  47.   BKL is designed around H. Yoshizaki's increasingly popular file
  48. archiving and compression program, LHA, which is widely available
  49. on BBS's without registration cost.  BKL was originally written
  50. around the file compression program PKZIP (if you use PKZIP, try
  51. this original batch file - BK.BAT).  However, PKZIP is shareware
  52. with a registration cost.  LHA is free.  Also, with version 2.13
  53. LHA is fast gaining on PKZIP in popularity.  Accordingly, the
  54. original BK.BAT file has been modified to work with LHA, version
  55. 2.13.  It has not been tested and may not work with earlier
  56. versions of LHA.  Since LHA costs nothing and BKL costs nothing,
  57. this backup method has zero cost, which certainly meets the
  58. requirement that it be cheap.
  59.  
  60.   It is quick because it doesn't backup everything.  Backups are
  61. split among several .LZH files and/or disks.  Since some types of
  62. files (e.g., batch files or configuration files) may change less
  63. frequently than others (spreadsheets, wordprocessing documents,
  64. etc.), they don't need backups as frequently.  For example, you
  65. could backup data files daily and batch files weekly or monthly.
  66.  
  67.   Such selective backups can be done more often, in less time,
  68. and with less disk swapping.  BKL runs from the DOS command line
  69. and avoids using a lot of switches or hard-to-remember codes.
  70. This makes it easy to use.
  71.  
  72.   Since BKL is a batch file, it's easy to modify with any text
  73. editor.  The list files are also ASCII text files, so modifying
  74. them is easy when you want to change your backup list.
  75.  
  76.   Lastly, since this backup program adds only one small batch
  77. file, besides the LHA program itself, it doesn't take up much
  78. disk space and doesn't add to the clutter of mystery files on
  79. your hard disk.  You will need to create some list files, but
  80. those are maintained on the floppies with your backups, not on
  81. your hard disk.
  82.  
  83.  
  84.  
  85.                            THE METHOD
  86.  
  87.   You'll need to create one or more list files.  A list file has
  88. the extension .LST and is merely a list of the files you want to
  89. backup together in the same .LZH (LHA's archive extension) file. 
  90. Save the .LST file on the same floppy disk that will hold that
  91. backup archive.
  92.  
  93.   To perform a backup, insert the backup disk and call BKL.BAT
  94. with a command line parameter identifying which list you want to
  95. use.  BKL will call your copy of LHA.EXE and instruct it to look
  96. for the appropriate .LST file on the floppy disk, compress and/or
  97. update the files in that list, and save the compressed .LZH
  98. archive on the floppy.  BKL then updates the date and time stamp
  99. of a directory entry with the extension .UPD on the floppy.
  100.  
  101.   You can have any number of .LST files on your disk, subject to
  102. available space, though remember that the program will add the
  103. .LZH files and .UPD directory entries to the same disk. Here is
  104. an example of a directory listing of a backup disk.
  105.  
  106.          Directory of  A:\
  107.  
  108.         BATCH    UPD        0  08-09-91  11:22a
  109.         CONFG    UPD        0  08-09-91  11:25a
  110.         BATCH    LST       49  11-06-90   9:57p
  111.         CONFG    LST      404  12-08-90   4:49p
  112.         BATCH    LZH    19420  08-09-91  11:22a
  113.         CONFG    LZH    61944  06-17-91  12:05p
  114.  
  115.   Issuing the command "BKL BATCH A:" at the DOS command line will
  116. cause the BKL program to look on drive A: for the file BATCH.LST. 
  117. The file BATCH.LZH will be created or updated with the files you
  118. specified in the BATCH.LST file.  When BKL is finished updating
  119. the .LZH file, it will update the BATCH.UPD directory entry with
  120. the current date.  Similarly, the command "BKL CONFG A:" would
  121. update the CONFG.LZH file.
  122.  
  123.   If preferred, you can keep the .LST files (or even the .UPD
  124. files) on your hard disk; simply alter the BKL batch file
  125. accordingly.
  126.  
  127.  
  128.  
  129.                      THE SETUP -- LIST FILES
  130.  
  131.   Here is an example of a file list in a .LST file.  The .LST
  132. file is an ASCII text file consisting of a list of files that you
  133. want included together in the same .LZH file.  Note that DOS
  134. wildcards can be used.
  135.  
  136.         c:\dbase\config.db
  137.         c:\ato\*.dfn
  138.         c:\ato\*.ppn
  139.         c:\wp50\wp{wp}.set
  140.         c:\wp50\wp{wp}en.sup
  141.         c:\wp50\wpm\*.wpm
  142.  
  143.   Use a text editor to create or modify your .LST files as
  144. desired.  For example, batch files could be grouped together, or
  145. utility files, or databases, or your wordprocessing document
  146. files, or as in the example above, it could be a group of seldom
  147. changed setup or configuration files for a variety of programs. 
  148. Since some groups of files don't change as often as others, some
  149. backups need not be done as often as others.  You may want to run
  150. a "data" backup daily but only need a "config" backup weekly.
  151.  
  152.   Parameter names should be descriptive (BATCH, CONFG, UTIL, WP,
  153. LOTUS, BANK, etc.) to make them easy to remember.  The parameter
  154. name is limited to no more than eight characters, and can include
  155. only characters legal for DOS filenames.  Add the extension
  156. ".LST" for a list file, and save it on your backup disk.
  157.  
  158.  
  159.  
  160.                        THE SETUP -- BKL.BAT
  161.  
  162.   The program file BKL.BAT should be ready to run in most cases. 
  163. If necessary, it may be modified to accommodate your system.
  164.  
  165.   As supplied, the batch file will backup to drives A: or B:,
  166. which must be specified on the command line (there is no default
  167. for the drive parameter).  You can change the drives that you
  168. will allow to be used for your backups by altering the lines
  169. following the label ":start" in the BKL.BAT file.  If you prefer,
  170. you can also have the program use a default drive.  For example,
  171. to default to drive A: when no drive parameter is specified on
  172. the command line, change the line:
  173.                          "if %drv%!==! goto noparm"
  174.       to:                "if %drv%!==! set drv=A:"
  175.  
  176.   Following the ":pack" label, include the path to the directory
  177. where your copy of LHA.EXE is, if necessary.  The pathname is
  178. optional if LHA.EXE will be accessible on your DOS path.
  179.  
  180.   BKL makes use of another file, CHKDRV.COM, to bypass that
  181. annoying "Abort, Retry, Fail..." message if you forget to put a
  182. floppy in the drive.  CHKDRV.COM is a slightly modified version
  183. of DTEST.COM, published in PC/Computing Magazine's April 1991
  184. issue.  If you don't use CHKDRV.COM you will need to remove two
  185. lines from BKL.BAT.  If you do use it, include the path to it in
  186. BKL.BAT if necessary.
  187.  
  188.  
  189.  
  190.                       MISCELLANEOUS DETAILS
  191.  
  192.   BKL uses the DOS environment to store variables. If you do not
  193. have enough environment space available, it may not run properly. 
  194. If you get an "Out of environment space" message, check your DOS
  195. manual for instructions on increasing the size of your
  196. environment space.
  197.  
  198.   The .UPD entries are just directory entries; they don't use up
  199. any disk space.  Since the .LZH files should also contain the
  200. date and time of the backup, the .UPD's may seem to be redundant.
  201. However, if a backup is run but none of the files need updating,
  202. the .LZH entry's date is not updated.  Updating the .UPD entry in
  203. these situations records the fact that your .LZH file is still
  204. current as of the .UPD date, regardless of the date stamp on the
  205. .LZH file.  (Hint: sort your directories so the .UPD entries are
  206. at the top so it's easier to see when the last backups were.)
  207.  
  208.   Once files are compressed into the .LZH file, this program
  209. updates only the files that have changed.  It also stores the
  210. full pathname (but not the drive).  This means that a file can be
  211. restored by moving to the root directory of the target drive and
  212. using LHA's ability to recreate subdirectories, if desired. 
  213. Using the syntax "LHA x [archive] [file]" will extract the file
  214. named [file] from the .LZH file named [archive].  The "x" option
  215. will recreate the stored pathname in the current directory and
  216. extract [file] to the subdirectory.  Using the "e" option,
  217. instead, will ignore the stored pathname and extract [file] to
  218. the current directory.
  219.  
  220.  
  221.  
  222.                     BACKING UP MULTIPLE LISTS
  223.  
  224.   If you wish to back up multiple lists at one time, simply write
  225. a separate batch file with a series of "call bkl..." lines.  Use
  226. the optional parameter, "chain", to facilitate summarization of
  227. errors.  The "chain" parameter causes BKL to save the error
  228. summary and chain it to the next call to BKL.  To run multiple
  229. backups at once, create a separate batch file similar to:
  230.  
  231.      call bkl chain [list1] [d:]
  232.      call bkl chain [list2] [d:]
  233.      call bkl chain [list3] [d:]
  234.           ...
  235.      call bkl chain [listY] [d:]
  236.      call bkl       [listZ] [d:]
  237.  
  238. Leave the "chain" parameter off the last call.  Upon finishing
  239. the last call, BKL will display a summary of any errors occurring
  240. on the earlier calls.
  241.  
  242.   The above multi-run sample batch file requires DOS 3.3 or
  243. later.  Earlier DOS versions do not support the "call" command. 
  244. BKL works fine with earlier DOS versions, but without the "call"
  245. command, BKL won't be able to summarize errors in a multiple-
  246. backup run.
  247.  
  248.   I have written an alternate version of BKL.BAT for multiple-
  249. list use with DOS 3.2 or earlier.  This version, BKL-ALT.BAT, has
  250. the changes necessary to get a proper error summary at the end of
  251. the last call.  To do a multiple-list backup, create a separate
  252. batch file as above, but change the "call bkl..." commands to
  253. "command /c bkl-alt...".  Include the path before the "command
  254. /c..." if your copy of COMMAND.COM is not on your path.
  255.  
  256.  
  257.  
  258.  
  259.                            DISCLAIMER
  260.  
  261.   This is just a batch file.  There are no fancy CPU tricks or
  262. machine-specific commands.  I make no warranties except that it
  263. works for me.  Basically, it is just a demonstration of how you
  264. can use routine batch techniques to write your own backup program
  265. around the popular LHA program.  Therefore, it is not copyrighted
  266. and does not cost you anything.
  267.  
  268.   PKZIP is a trademark of PKWARE, Inc.
  269.  
  270.   I'm interested in feedback or comments from anyone.
  271.  
  272.  
  273.  
  274.  
  275.                          by Dan Goodell    
  276.                        1261 Hookston Road  
  277.                        Concord, CA  94518  
  278.                      CompuServe: 71520,3116
  279.  
  280.  
  281.  
  282.  
  283.  
  284.          ----------------end-of-author's-documentation---------------
  285.  
  286.                          Software Library Information:
  287.  
  288.                     This disk copy provided as a service of
  289.  
  290.                            Public (software) Library
  291.  
  292.          We are not the authors of this program, nor are we associated
  293.          with the author in any way other than as a distributor of the
  294.          program in accordance with the author's terms of distribution.
  295.  
  296.          Please direct shareware payments and specific questions about
  297.          this program to the author of the program, whose name appears
  298.          elsewhere in  this documentation. If you have trouble getting
  299.          in touch with the author,  we will do whatever we can to help
  300.          you with your questions. All programs have been tested and do
  301.          run.  To report problems,  please use the form that is in the
  302.          file PROBLEM.DOC on many of our disks or in other written for-
  303.          mat with screen printouts, if possible.  PsL cannot debug pro-
  304.          programs over the telephone, though we can answer questions.
  305.  
  306.          Disks in the PsL are updated  monthly,  so if you did not get
  307.          this disk directly from the PsL, you should be aware that the
  308.          files in this set may no longer be the current versions. Also,
  309.          if you got this disk from another vendor and are having prob-
  310.          lems,  be aware that  some files may have become corrupted or
  311.          lost by that vendor. Get a current, working disk from PsL.
  312.  
  313.          For a copy of the latest monthly software library newsletter
  314.          and a list of the 4,000+ disks in the library, call or write
  315.  
  316.                            Public (software) Library
  317.                                P.O.Box 35705 - F
  318.                             Houston, TX 77235-5705
  319.  
  320.                                 1-800-2424-PSL
  321.                              MC/Visa/AmEx/Discover
  322.  
  323.                           Outside of U.S. or in Texas
  324.                           or for general information,
  325.                               Call 1-713-524-6394
  326.  
  327.                           PsL also has an outstanding
  328.                           catalog for the Macintosh.
  329.  
  330.